package com.lemon.components.ant.util;

import org.apache.commons.lang3.StringUtils;

public class JdbcUtil {

	public static String typeCoverJdbc2Java(String jdbcType){
		if(StringUtils.isBlank(jdbcType)){
			return null;
		}
		jdbcType = jdbcType.toLowerCase();
		switch (jdbcType) {
		case "bigint":
		case "bigint unsigned":
			return "Long";
		case "tinyint":
		case "bit":
			return "Boolean";
		case "int":
			return "Integer";
		case "varchar":
		case "char":
		case "longtext":
		case "mediumtext":
		case "text":
			return "String";
		case "polygon":
			return "org.locationtech.jts.geom.Polygon";
		case "linestring":
			return "org.locationtech.jts.geom.LineString";
		case "multilinestring":
			return "org.locationtech.jts.geom.MultiLineString";
		case "decimal":
			return "Double";
		case "float":
			return "Float";
		case "date":
		case "datetime":
		case "timestamp":
			return "Date";
		case "json":
			return "com.nh.micro.ext.ExtBeanWrapper";
		default:
			return jdbcType;
		}
	}
}
